#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QPushButton>
#include <QPixmap>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void updateDate(char *humi, char *temp, char *val);
    void Show_Text(char *humi, char *temp, char *val);
    void setButtonIcon(QPushButton *button, const QString &imagePath);
public slots:
    void clientConnect();
    void Readyread();

    void slotToggleButton_Led();   // 切换按钮1
    void slotToggleButton_Beep();   // 切换按钮2
    void slotToggleButton_Fan();   // 切换按钮3
    void slotToggleButton_breath();
    void slotToggleButton_music();


private slots:
    void handleSocketError(QAbstractSocket::SocketError socketError);



private:
    Ui::MainWindow *ui;

    QTcpSocket *clientSocket;

    // 记录每个按钮的开关状态
    bool buttonbeepState;
    bool buttonledState;
    bool buttonfanState;
    bool buttonmusicState;
    bool buttonbreathState;
};
#endif // MAINWINDOW_H
